﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Text;
using System.Web.UI;
using System.Web.Security;
using System.Web.UI.WebControls;
using System.Data.OracleClient;
using System.Data;
using System.Configuration;

public partial class _Default : System.Web.UI.Page
{

    public void Button1_Click(object sender, EventArgs e)
    {
        string Usuer = "";
        OracleConnection conn = null;
        string sqluser = "Select * From tb_sec_users Where username='" + cxLogin.Text.ToUpper() + "' And pwd_net='" +cxSenha.Text.ToUpper() + "'";
      //  OracleConnection conn = CConectarOracle.obterConexao();
        conn = new OracleConnection(ConfigurationManager.ConnectionStrings["BdOracle"].ConnectionString);
        OracleCommand comm = new OracleCommand(sqluser, conn);
        conn.Open();
        //fim da conexao

        //Verificando a Conexao.
        OracleDataReader Oracloc = comm.ExecuteReader();

       if (!Oracloc.Read())
        {

            lbMsg.Text = "Não conectado verificar Login ou Senha.";

        }
        else
           
        {
      // Response.Redirect("Default.aspx");
       Usuer = Oracloc["userid"].ToString();
       if (Usuer == "1521")
       {
           Response.Redirect("Default.aspx");
       }
       else
       {
           Session["userid"] = Usuer;
           Response.Redirect("Default2.aspx");
           
       }

     //  lbMsg.Text = Usuer;
        }  

    }
}
        
   
 
 
